<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>v-for和v-bind</title>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <ul>
            <li :class="{active:isActive}" v-for="(val,index) in movies" v-on:click="setClass(index)">{{val}}</li>
        </ul>
    </div>
</body>
  <script src="../js/vue.js"></script>
  <script>
      var app = new Vue({
          el: '#app',
          data: {
              movies: ['海王','海尔兄弟','波塞冬','三叉戟','民兵'],
              active: 'active',
              isActive: false,
          },
          methods: {
              setClass: function (index) {
                this.isActive = !this.isActive;
              }
          }
      })
  </script>
</html>